﻿$(document).ready(function () {
	var oTable = $('#poStyleDataTable').dataTable({
		"bServerSide": true,
		"bJQueryUI": true,
		"sScrollX": "100%",
		"sScrollXInner": "110%",
		"bScrollCollapse": true,
		"bAutoWidth": false,
		"sAjaxSource": "postyle/AjaxHandler",
		"bProcessing": true,
		"oLanguage": {
			"sSearch": "Search"
		},
		"aoColumns": [
			{ "sName": "ID",
				"bSearchable": false,
				"bSortable": false,
				"fnRender": function (oObj) {
				    return '<a href=\"postyle/Edit/' + oObj.aData[0] + '\" class = "edit"> Edit</a> | '
                         + '<a href=\"postyle/Delete/' + oObj.aData[0] + '\" class = "delete">Delete</a>'
                         + '</br>'
                         + '<a href=\"postyle/Copy/' + oObj.aData[0] + '\" class = "copy"> Copy</a> |'
                         + '</br>'
                         + '<a href=\"/Shipment/Index/' + oObj.aData[0] + '\" class = "shipment"> Shipment</a> '
                         + '<a href=\"postyle/CostSheet/' + oObj.aData[0] + '\" class = "costsheet"> CostSheet</a>';
				}
			},
			{ "sName": "PoNo" },
			{ "sName": "StyleNo" },
			{ "sName": "style_description" },
			{ "sName": "capacity" },
			{ "sName": "buyer_name" },
			{ "sName": "devision" },
			{ "sName": "season" },
			{ "sName": "factory" },
			{ "sName": "fob" },
			{ "sName": "agreed_cm" },
			{ "sName": "order_quantity" },
			{ "sName": "ExitDate" }
		]
	});

	$(window).bind('resize', function () {
		oTable.fnAdjustColumnSizing();
	});
});